<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>订单信息管理</el-breadcrumb-item>
    </el-breadcrumb>
    <!--列表-->
    <el-table size="small" :data="orderList" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 80%;">
      <el-table-column align="center" prop="id" label="订单编号" width="200">
      </el-table-column>
      <el-table-column sortable align="center" prop="amount" label="购买数量" width="200">
      </el-table-column>
      <el-table-column align="center" prop="consigneeAddress" label="收货地址" width="200"></el-table-column>
      <el-table-column align="center" prop="consigneeName" label="收货人" width="200"></el-table-column>
      <el-table-column sortable align="center" prop="consigneePhone" label="收货手机号" width="200"></el-table-column>
      <el-table-column sortable align="center" prop="totalMoney" label="订单总额" width="200"></el-table-column>
      <el-table-column align="center" prop="status" label="支付状态" width="200">
        <template slot-scope="scope">
          <span :style="{color: scope.row.status ? '#4fc08d' : '#ff6600'}">
            {{scope.row.status ? '已支付' : '未支付'}}
          </span>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <Pagination v-bind:child-msg="pageQuery" @callFather="callFather"></Pagination>
  </div>
</template>

<script>
import Pagination from '../../components/Pagination'
export default {
  name:'Order',
  data() {
    return {
      orderList: [], //用户列表
      pageQuery: {
        pageNum: 1,
        pageSize: 10
      },
      loading: false //是显示加载
    }
  },
  // 注册组件
  components: {
    Pagination
  },
  created() {
    this.getOrderList(this.pageQuery)
  },
  methods: {
    /**
     * 获取订单列表
     */
    getOrderList(pageQuery) {
      this.loading = true
      this.$api.auth.getOrderList(pageQuery).then(res => {
        if (res.code === 200) {
          this.orderList = res.data.records
          this.loading = false
        }
      }).catch(err => this.loading = false)
    },
    /**
     * 分页插件事件
     */
    callFather(parm) {
      this.pageQuery.pageNum = parm.currentPage
      this.pageQuery.pageSize = parm.pageSize
      this.getOrderList(this.pageQuery)
    }
  }
}
</script>

<style>
.order-search {
  margin-top: 20px;
}
.orderRole {
  width: 100%;
}
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>

 
 